home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6642 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: apollo36.eis.enac.dgac.fr!mathey
  2. From: mathey@apollo36.eis.enac.dgac.fr (mathey)
  3. Newsgroups: comp.lang.c++
  4. Subject: Q: friend templates ...
  5. Date: 12 Feb 1996 11:20:43 GMT
  6. Distribution: world
  7. Message-ID: <4fn7qb$i7n@news.cict.fr>
  8. NNTP-Posting-Host: apollo36.eis.enac.dgac.fr
  9. Keywords: friend templates
  10.  
  11. Hello to everyone contributing to this execellent newsgroup,
  12.  
  13. Here's the little problem I'm currently facing :
  14.  
  15. I have 2 template classes :
  16.  
  17. template <class T,class W> class Container {
  18.  
  19. ...
  20.  
  21. };
  22.  
  23. template <class T> class Pattern {
  24.  ...
  25.  
  26. };
  27.  
  28. What i want to do is to declare that all possible instances with respect 
  29. to the second formal template parameter W of class Container are friends of 
  30. class Pattern (e.g. Container<float,_everything_> is friend of Pattern<float> 
  31. and so on ...)
  32.  
  33. I've tried something like this :
  34.  
  35. template <class T> class Pattern {
  36.  
  37. template <class W> friend class Container<T,W>;
  38.  
  39. }
  40.  
  41. but it obviously doesn't work
  42.  
  43. I guess this question has already been posted but I can't seem to find any trace of it so i would greatly appreciate any hint / solution  ...
  44.  
  45. Thanks in advance .
  46.  
  47. Cyril.
  48.  
  49. mathey@eis.enac.dgac.fr
  50.   
  51.  
  52.